package com.rs.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.rs.service.AuditInformationService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.rs.dao.ZhItemsRecipientsMapper;
import com.rs.dao.ZhOvertimeMapper;
import com.rs.dao.ZhUserMapper;
import com.rs.model.CommonResult;
import com.rs.model.ZhItemsRecipients;
import com.rs.model.ZhOvertime;
import com.rs.model.ZhUser;


@Service
@Transactional
public class AuditInformationServiceImpl implements AuditInformationService {
	
	static final Integer NUMBER=10;
	
	@Autowired
	ZhUserMapper ZhUserMapper;

	
	
	//人员信息审核
	@Override
	public CommonResult<Integer> updateUserAudit(ZhUser user) {
		// TODO Auto-generated method stub
		int state = ZhUserMapper.updateUserAudit(user);
		if(state==0) {
			return new CommonResult<Integer>(200,"修改失败");
		}
		return new CommonResult<Integer>(200,"修改成功");
	}


	//根据审核状态查看人员信息
	@Override
	public Page<ZhUser> stateSelectUser(ZhUser user) {
		// TODO Auto-generated method stub
		PageHelper.startPage(user.getPageNum(),NUMBER);
		return ZhUserMapper.stateSelectUser(user);
	}

	/*@Autowired
	ZhReissueCardMapper zhReissueCardMapper;//---------------------------------------------
	
	//修改补卡信息审核状态
	@Override
	public CommonResult<Integer> updateReissueCardAudit(ZhReissueCard record) {
		// TODO Auto-generated method stub
		int state = zhReissueCardMapper.updateReissueCardAudit(record);
		if(state==0) {
			return new CommonResult<Integer>(200,"修改失败");
		}
		return new CommonResult<Integer>(200,"修改成功");
	}

	//根据状态查看所有补卡的信息（集合）
	@Override
	public Page<ZhReissueCard> stateSelectZhReissueCard(ZhReissueCard record) {
		// TODO Auto-generated method stub
		PageHelper.startPage(record.getPageNum(),NUMBER);
		return zhReissueCardMapper.stateSelectZhReissueCard(record.getReAtid());
	}
	
	 
    //员工查询自己的所有补卡信息
    public Page<ZhReissueCard> selectOneselfZhReissueCard(ZhReissueCard record){
    	PageHelper.startPage(record.getPageNum(),NUMBER);
		return zhReissueCardMapper.selectOneselfZhReissueCard(record);
    }

	
	
	@Autowired
	ZhGoOutMapper zhGoOutMapper;//---------------------------------------------
	
	 //人员外出信息审核
	@Override
	public CommonResult<Integer> updateGoOutAudit(ZhGoOut record) {
		// TODO Auto-generated method stub
		int state = zhGoOutMapper.updateGoOutAudit(record);
		if(state==0) {
			new CommonResult<Integer>(200,"修改失败");
		}
		return new CommonResult<Integer>(200,"修改成功");
	}

	//根据审核状态查询所有人员的外出信息记录
	@Override
	public Page<ZhGoOut> selectGoOutAudit(ZhGoOut record) {
		// TODO Auto-generated method stub
		PageHelper.startPage(record.getPageNum(),NUMBER);
		return zhGoOutMapper.selectGoOutAudit(record.getGoAudit());
	}
	

	 //员工查看自己所有的外出审核信息
   public Page<ZhGoOut> selectOneselfGoOutAudit(ZhGoOut record){
   	PageHelper.startPage(record.getPageNum(),NUMBER);
		return zhGoOutMapper.selectOneselfGoOutAudit(record);
   }
   
   
   
   @Autowired
   ZhOnBusinessMapper zhOnBusinessMapper;//--------------------------------------出差信息审核


	@Override
	public CommonResult<Integer> updateOnBusinessAudit(ZhOnBusiness record) {
		// TODO Auto-generated method stub
		int state = zhOnBusinessMapper.updateOnBusinessAudit(record);
		if(state==0) {
			new CommonResult<Integer>(200,"修改失败");
		}
		return new CommonResult<Integer>(200,"修改成功");
	}
	
	
	@Override
	public Page<ZhOnBusiness> selectOnBusinessAudit(ZhOnBusiness record) {
		// TODO Auto-generated method stub
		PageHelper.startPage(record.getPageNum(),NUMBER);
		return zhOnBusinessMapper.selectOnBusinessAudit(record.getOnAudit());
	}
	
	
	@Override
	public Page<ZhOnBusiness> selectOneselfOnBusinessAudit(ZhOnBusiness record) {
		// TODO Auto-generated method stub
		PageHelper.startPage(record.getPageNum(),NUMBER);
		return zhOnBusinessMapper.selectOneselfOnBusinessAudit(record);
	}*/

	
	
	
	
	@Autowired
	ZhOvertimeMapper zhOvertimeMapper;

	@Override
	public CommonResult<Integer> updateOvertimeAudit(ZhOvertime record) {
		// TODO Auto-generated method stub
		int state = zhOvertimeMapper.updateOvertimeAudit(record);
		if(state==0) {
			new CommonResult<Integer>(200,"修改失败",state);
		}
		return new CommonResult<Integer>(200,"修改成功",state);
	}


	@Override
	public Page<ZhOvertime> selectOvertimeAudit(ZhOvertime record) {
		// TODO Auto-generated method stub
		PageHelper.startPage(record.getPageNum(),NUMBER);
		return zhOvertimeMapper.selectOvertimeAudit(record.getOvAudit());
	}


	@Override
	public Page<ZhOvertime> selectOneselfOvertimeAudit(ZhOvertime record) {
		// TODO Auto-generated method stub
		PageHelper.startPage(record.getPageNum(),NUMBER);
		return zhOvertimeMapper.selectOneselfOvertimeAudit(record);
	}


	@Override
	public ZhOvertime getIdOvertime(Integer id) {
		// TODO Auto-generated method stub
		return zhOvertimeMapper.selectByPrimaryKey(id);
	}

	
	
/*	@Autowired
	ZhAskForMapper zhAskForMapper;


	@Override
	public CommonResult<Integer> updateZhAskForAudit(ZhAskFor record) {
		// TODO Auto-generated method stub
		int state = zhAskForMapper.updateZhAskForAudit(record);
		if(state==0) {
			new CommonResult<Integer>(200,"修改失败");
		}
		return new CommonResult<Integer>(200,"修改成功");
	}


	@Override
	public Page<ZhAskFor> selectZhAskForAudit(ZhAskFor record) {
		// TODO Auto-generated method stub
		PageHelper.startPage(record.getPageNum(),NUMBER);
		return zhAskForMapper.selectZhAskForAudit(record.getAskAudit());
	}


	@Override
	public Page<ZhAskFor> selectOneselfZhAskForAudit(ZhAskFor record) {
		// TODO Auto-generated method stub
		PageHelper.startPage(record.getPageNum(),NUMBER);
		return zhAskForMapper.selectOneselfZhAskForAudit(record);
	}*/

	
	@Autowired
	ZhItemsRecipientsMapper zhItemsRecipientsMapper;

	@Override
	public CommonResult<Integer> updateItemsRecipientsAudit(ZhItemsRecipients record) {
		// TODO Auto-generated method stub
		int state = zhItemsRecipientsMapper.updateItemsRecipientsAudit(record);
		if(state==0) {
			new CommonResult<Integer>(200,"修改失败",state);
		}
		return new CommonResult<Integer>(200,"修改成功",state);
	}


	@Override
	public Page<ZhItemsRecipients> selectItemsRecipientsAudit(ZhItemsRecipients record) {
		// TODO Auto-generated method stub
		PageHelper.startPage(record.getPageNum(),NUMBER);
		return zhItemsRecipientsMapper.selectItemsRecipientsAudit(record.getIt_audit());
	}


	@Override
	public Page<ZhItemsRecipients> selectOneselfItemsRecipientsAudit(ZhItemsRecipients record) {
		// TODO Auto-generated method stub
		PageHelper.startPage(record.getPageNum(),NUMBER);
		return zhItemsRecipientsMapper.selectOneselfItemsRecipientsAudit(record);
	}


	@Override
	public ZhItemsRecipients getIdZhItemsRecipients(Integer id) {
		// TODO Auto-generated method stub
		return zhItemsRecipientsMapper.getIdZhItemsRecipients(id);
	}


	/*@Autowired
	ZhReimburseMapper ZhReimburseMapper;
	
	
	@Override
	public CommonResult<Integer> updateReimburseAudit(ZhReimburse record) {
		// TODO Auto-generated method stub
		int state = ZhReimburseMapper.updateReimburseAudit(record);
		if(state==0) {
			new CommonResult<Integer>(200,"修改失败");
		}
		return new CommonResult<Integer>(200,"修改成功");
	}


	@Override
	public Page<ZhReimburse> selectReimburseAudit(ZhReimburse record) {
		// TODO Auto-generated method stub
		PageHelper.startPage(record.getPageNum(),NUMBER);
		return ZhReimburseMapper.selectReimburseAudit(record.getReAudit());
	}


	@Override
	public Page<ZhReimburse> selectOneselfReimburseAudit(ZhReimburse record) {
		// TODO Auto-generated method stub
		PageHelper.startPage(record.getPageNum(),NUMBER);
		return ZhReimburseMapper.selectOneselfReimburseAudit(record);
	}*/
	
	
	

}
